﻿using Entity.FrameEntity;
using Entity;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DBService
{
    public interface IDbServices
    {
        /// <summary>
        /// 根据数据模型获取数据集合
        /// </summary>
        /// <param name="obj">数据模型</param>
        /// <returns>table数据表</returns>
        DataTable Query(object obj);


        #region 多表事物更新方法(仅做添加、删除、修改使用)
        /// <summary>
        /// 多表事物更新方法(仅做添加、删除、修改使用)
        /// </summary>
        /// <param name="cmdlist">执行SQL语句</param>
        /// <param name="parlist">参数集合</param>
        /// <returns></returns>
        ReturnResult TransUpdate(List<OperateModel> list);
        #endregion



        /// <summary>
        /// sql更新数据
        /// </summary>
        /// <param name="sql">执行sql</param>
        /// <returns></returns>
        ReturnResult UpdataBySql(string sql);
        /// <summary>
        /// 查询语句
        /// </summary>
        /// <param name="sql">执行sql</param>
        /// <returns></returns>
        DataTable QueryBySql(string sql);


        /// <summary>
        /// 分页查询数据列表
        /// </summary>
        /// <param name="tableName">表名称</param>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="pageSize">页面信息数</param>
        /// <param name="sqlWhere">where条件</param>
        /// <param name="orderStr">排序字段</param>
        /// <param name="pageCount">信息总数</param>
        /// <returns></returns>
        DataTable PageList(string tableName, string pageIndex, string pageSize, string sqlWhere, string orderStr, ref string pageCount);
    }
}

